Skip to content

fix(core-sync): a key rotation never keeps a key device no device row holds - #4701

Merged
datlechin merged 5 commits into
mainfrom
fix/core-sync-rotation-keep-removed
Nov 28, 2026
Merged

datlechin merged 5 commits into
mainfrom
fix/core-sync-rotation-keep-removed

Conversation

@datlechin

@datlechin datlechin commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Core: the removal review and Replace Recovery Key read the account's device rows (GET /v2/devices, every page, new ServiceTransport::rows_with_key_devices). A certified key device no row holds was removed or signed out, so it joins the lost ones and is never offered, compared or not. Removing a row now drops every key device of it, the one from before a sign-out too (E2E F32).
  • Core: ReviewedDevice.can_keep says what the person can tick; keep_by_default follows it.
  • Core: finish_removal refuses a keep the review did not offer and finish_replace one the draft did not offer (sync.not_allowed); a never-compared keep still answers keys.not_compared. Both read the rows again before building, so a device that signed out or lost its row while the sheet was open is not kept.
  • FFI: ReviewedDeviceInfo.can_keep. Key devices keep the names of rows the engine read earlier in the session, so the review names a removed row's key devices as the Devices list did, with no row.
  • macOS and Windows: the reviews take can_keep from the core and label a key device no row holds "Removed" instead of "Asks for approval again".
  • Core: /v2/sync answering device_removed ends the account's sign-in held under that token (SignOutCause::DeviceRevoked) at once (E2E F33).
  • macOS: Settings > Account says the Mac was removed after that sign-out, and the Sync pane's text for sync.device_removed no longer says to approve it.
  • Updated on purpose: the fake key flows test removing_a_device_needs_a_step_up_then_r_and_keeps_only_compared_devices gives each device a row and adds a compared signed-out device; the Swift and C# review fixtures gain canKeep.

Test plan

  • Fail with the rule reverted, pass here: device_flows rotation::removing_a_row_drops_its_key_device_from_before_a_sign_out_though_it_was_compared, rotation::a_key_device_no_row_holds_is_never_offered_to_a_removal_even_when_compared, rotation::a_replace_never_keeps_a_compared_device_that_signed_out.
  • Rows changing while the sheet is open: rotation::a_device_that_signs_out_while_the_review_is_open_is_not_kept, rotation::a_device_that_signs_out_while_a_replace_draft_is_open_is_not_kept.
  • New: http the_rows_with_key_devices_come_from_every_page_of_the_device_list, the device_removed assertion in a_step_up_challenge_and_the_whole_request_refusals_read_as_their_errors, account a_removed_row_heard_by_sync_signs_out_as_device_revoked, FFI a_key_device_whose_row_was_removed_keeps_the_name_the_engine_read_before.
  • macOS: AccountRemovalFlowTests/removedDeviceIsNeverKept, AccountRecoveryKeyFlowTests/replaceSkipsRemovedDevice, AccountServicesTests/signOutCauseStaysUntilSignIn, AccountSettingsContentTests/signedOutAsRemoved, ProviderMovesTests/removedMacHasItsOwnWords.
  • Local verify (verify.sh --jobs 4): core tablepro-sync PASS 1031/1031, core tablepro-sync-testing PASS 100/100, core tablepro-account PASS 212/212, core tablepro-ffi PASS 524/524, --platform windows bindings regenerated (can_keep only), Windows TablePro.App.Model.Tests 1287 passed on the Mac, lint PASS on every changed Swift file.
  • macOS (verify.sh --jobs 4 test of the 8 suites above and around it): PASS 162/162; l10n PASS after adding the two new strings.
  • iOS (verify.sh ios AccountCoreSignInTests AccountModelTests, core rebuilt with the simulator slice): PASS 13/13.
  • Codex: one review and security pass, then a follow-up on the fixes; nothing blocking left.

@datlechin
datlechin merged commit e2514e4 into main Nov 28, 2026
8 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant